package com.dixon.worddayday.controller;

import com.google.gson.Gson;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Slf4j
@Controller
public class BaseController {

    @Autowired
    private Gson gson;

    @ModelAttribute
    public void log(HttpServletRequest request, HttpServletResponse response) {
        log.info("req : {} params: {}", request.getRequestURL(), gson.toJson(request.getParameterMap()));
//        log.info(new Gson().toJson(request.getAttributeNames()));
    }
}
